﻿#pragma once

#include "glm/glm.hpp"

#include "core/Macro.h"

namespace Engine
{
	class ENGINE_API Camera
	{
	public:
		Camera(float left, float right, float bottom, float top);

		void SetProjectionMatrix(float left, float right, float bottom, float top);
		void SetPosition(const glm::vec3& position);
		void SetRotation(const float& rotation);

		[[nodiscard]] const glm::mat4& GetViewMatrix() const { return viewMatrix; }
		[[nodiscard]] const glm::mat4& GetProjectionMatrix() const { return projectionMatrix; }
		[[nodiscard]] const glm::mat4& GetViewProjectionMatrix() const { return viewProjectionMatrix; }

		// void ProcessKeyboard(CameraMovement direction, float deltaTime);
		// void ProcessMouseMovement(float xOffset, float yOffset, bool constrainPitch = true);
		// void ProcessMouseScroll(const float yOffset);

		void ChangeCamera() { isPerspective = !isPerspective; }

	private:
		void UpdateViewMatrix();

		// true 为透视投影，false 为正交投影
		bool isPerspective = true;

		glm::vec3 position = {0.0f, 0.0f, 0.0f};
		float rotation = 0.0f;

		// 观察矩阵
		glm::mat4 viewMatrix = glm::mat4(1.0f);

		// 投影矩阵
		glm::mat4 projectionMatrix = glm::mat4(1.0f);

		// 视图投影矩阵
		glm::mat4 viewProjectionMatrix = glm::mat4(1.0f);
	};
}
